<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .inputBox,
        .suammry {
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding: 10px;
            box-sizing: border-box;
        }

        .inputBox input {
            flex: 1;
            height: 40px;
            outline: none;
            border: none;
            padding-left: 20px;
            background-color: gainsboro;
            border-radius: 20px;
        }

        .inputBox span {
            display: inline-block;
            width: 60px;
            height: 40px;
            font-size: 18px;
            text-align: center;
            line-height: 40px;
            color: darkcyan;
        }



        .suammry span {
            display: inline-block;
            background-color: darkcyan;
            padding: 10px;
            color: white;
            border-radius: 10px;
            margin-right: 10px;
            text-align: center;
        }

        .suammry span:nth-child(3) {
            background-color: rgb(249, 62, 62);
        }

        .box {
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
        }

        .box h3 {
            margin: 10px 0 20px 0;
        }

        .task {
            display: flex;
            width: 100%;
            height: 50px;
            border-radius: 8px;
            box-sizing: border-box;
            padding-right: 10px;
            background-color: darkcyan;
            align-items: center;
            justify-content: space-between;
            font-size: 18px;
            margin-top: 10px;
            color: white;
        }

        .task div:nth-child(1) {
            margin: 0 20px;
        }

        .active {
            background-color: rgb(249, 62, 62);
        }

        .empty {
            width: 100%;
            text-align: center;
            margin-top: 50px;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="inputBox">
            <input type="text" v-model="taskName" placeholder="输入任务名称">
            <span @click="addTask">新增</span>
        </div>
        <div class="suammry">
            <span>全部任务( {{taskList.length}} )</span>
            <span>已完成( {{taskList.length-unFinishCount}} )</span>
            <span>未完成( {{unFinishCount}} )</span>
        </div>
        <div class="box">
            <h3>任务列表</h3>
            <div class="list">
                <div class="task" v-for="(item,index) in taskList" :class="{active:item.status==false}">
                    <div>
                        <span>
                            <input type="checkbox" @click="changStatus(item)" :checked="item.status">
                        </span>
                        <span>{{item.id}}</span>
                        <span>{{item.name}}</span>
                    </div>
                    <span @click="del(item,index)">删除</span>
                </div>
            </div>

            <div class="empty" v-show="taskList.length==0">任务列表为空，请添加一个任务！</div>
        </div>


    </div>
    <script src="1.vue-2.5.21.js"></script>
    <script src="2.zuoye-todolist.js"></script>
</body>

</html>